package chixing.day16;

import chixing.day15.work.PhoneManager;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class phonetest {
    public static void main(String[] args) {
        Phone phone1 = new Phone("苹果", "iphone 15", 1999);
        Phone phone2 = new Phone("小米", "Redmi K70", 3999);
        Phone phone3 = new Phone("华为", "华为nova 11SE", 3999);
        Phone phone4 = new Phone("华为", "华为70 Pro", 2999);
        Phone phone5 = new Phone("OPPO", "OPPO K12x", 4999);
        Phone phone6 = new Phone("苹果", "iphone 14", 6999);
        Phone phone7 = new Phone("小米", "Redmi  Note13", 1000);
        Phone phone8 = new Phone("OPPO", "OPPO A1i", 1999);
        Phone phone9 = new Phone("苹果", "iphone 13", 2999);
        Phone phone10 = new Phone("华为", "华为mate60", 2999);
        Phone phone11 = new Phone("华为", "华为nova12", 2999);
        Phone phone12 = new Phone("小米", "小米 12C", 2888);
        Phone phone13 = new Phone("苹果", "iphone 12", 1777);
        List<Phone> phoneList = new ArrayList<>();
        phoneList.add(phone1);
        phoneList.add(phone2);
        phoneList.add(phone3);
        phoneList.add(phone4);
        phoneList.add(phone5);
        phoneList.add(phone6);
        phoneList.add(phone7);
        phoneList.add(phone8);
        phoneList.add(phone9);
        phoneList.add(phone10);
        phoneList.add(phone11);
        phoneList.add(phone12);
        phoneList.add(phone13);
        Map<String, List<Phone>> classified = new HashMap<>();
        for (Phone phone : phoneList) {
            String brand = phone.getBrand();
            if (!classified.containsKey(brand)) {
                classified.put(brand, new ArrayList<>());
            }
            classified.get(brand).add(phone);
        }
    }
}
